package org.flower.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.flower.dao.NavigationDao;
import org.flower.entity.Navigation;
import org.flower.utils.BaseDao;
/**
 * 导航接口实现类
 * @author 29091
 *
 */
public class NavigationDaoImpl extends BaseDao implements NavigationDao {

	//查询出全部导航信息
	@Override
	public List<Navigation> getAllNavigation() {
		String sql = "select * from navigation";
		List<Navigation> navlist = new ArrayList<Navigation>();
		ResultSet rs = super.executeQuery(sql);
		try {
			while(rs.next()){
				Navigation nav = new Navigation(rs.getInt("id"),rs.getString("Name"),rs.getString("url"));
				navlist.add(nav);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				closeAll(rs,rs.getStatement(),rs.getStatement().getConnection());
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return navlist;
	}

}
